package com.example.demo.javase.thread;

/**
 * @author wangsl
 * @date 2020/6/25 0:47
 * <p>
 * Description:线程封闭,一个线程对应一个方法栈帧
 */
public class MyThread {

    private static int increase(){
        int i = 0;
        for (int j = 0; j < 10; j++) {
            i++;
        }
        return i;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    increase();
                    System.out.println(increase());
                }
            }).start();
        }
//        System.out.println(increase());
    }

}
